<template>
	<view class="container">

		<!-- 酒店信息 -->
		<view class="hotel-info">
			<view class="hotel-content">
				<view class="hotel-main">
					<text class="hotel-name">房间名：{{info.roomName}}</text>
					<view style="height: 10rpx;"></view>
					<text class="hotel-address" style="color: #333333;">床型：{{info.bedInfo}}</text>
					<view style="height: 10rpx;"></view>
					<text class="hotel-address" style="color: #333333;">房间大小：{{info.roomSize}}</text>
					<view style="height: 10rpx;"></view>
					<text class="hotel-address" style="color: #333333;">房间楼层：{{info.floorInfo}}</text>
				</view>
			</view>
		</view>
		<!-- 预订详情 -->
		<view class="booking-detail">
			<view class="detail-item">
				<text class="detail-label">要求内容</text>
				<input class="detail-input" v-model="form.content" type="text" placeholder="请输入要求内容" />
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="bottom-buttons">
			<view class="bottom-price">
				<text class="price-symbol"></text>
			</view>
			<view @click="reservation" class="book-button">提交</view>
		</view>
	</view>
</template>
<script>
	import {
		BASE_URL_ZJ
	} from '@/api/config';
	
	export default {
		data() {
			return {
				form: {
					content: ''
				},
				info: {}
			}
		},

		onLoad(options) {
			this.getDetail(options.id);
		},

		methods: {
			getDetail(id) {
				uni.request({
					url: BASE_URL_ZJ + '/room/byId/' + id,
					method: 'GET',
					success: res => {
						this.info = res.data.data;
					}
				})
			},
			
			reservation() {
				if (!this.form.content) {
					return uni.showToast({
						title: '请完善信息',
						icon: 'none'
					});
				}
				uni.request({
					url: BASE_URL_ZJ + '/roomRequirement/add',
					method: 'POST',
					data: {
						roomId: this.info.price,
						roomName: this.info.id,
						content: this.form.content,
						status: 1
					},
					success: res => {
						uni.showToast({
							title: '提交成功'
						})
					}
				})
			},
		}
	}
</script>
<style>
	page {
		height: 100%;
		background-color: #F5F5F5;
	}

	.container {
		display: flex;
		flex-direction: column;
		padding-bottom: 120rpx;
	}

	.hotel-info {
		margin: 20rpx;
		padding: 30rpx;
		background-color: #FFFFFF;
		border-radius: 12rpx;
	}

	.hotel-content {
		display: flex;
		justify-content: space-between;
		gap: 20rpx;
	}

	.hotel-main {
		flex: 1;
	}

	.hotel-name {
		font-size: 20px;
		font-weight: 600;
		color: #333333;
		margin-bottom: 16rpx;
	}

	.hotel-rating {
		display: flex;
		align-items: center;
		gap: 10rpx;
		margin-bottom: 16rpx;
	}

	.rating-text {
		font-size: 14px;
		color: #666666;
	}

	.hotel-address {
		font-size: 14px;
		color: #999999;
	}

	.hotel-image {
		width: 160rpx;
		height: 160rpx;
		border-radius: 8rpx;
	}

	.booking-detail {
		margin: 20rpx;
		padding: 30rpx;
		background-color: #FFFFFF;
		border-radius: 12rpx;
	}

	.detail-item {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}

	.detail-item:last-child {
		margin-bottom: 0;
	}

	.detail-label {
		font-size: 14px;
		color: #666666;
	}

	.detail-value {
		font-size: 14px;
		color: #333333;
	}

	.detail-input {
		font-size: 14px;
		color: #333333;
		text-align: right;
		padding: 4rpx 0;
		width: 300rpx;
	}

	.detail-picker {
		width: 300rpx;
	}

	.picker-text {
		font-size: 14px;
		color: #999999;
		text-align: right;
	}

	.payment-info {
		margin: 20rpx;
		padding: 30rpx;
		background-color: #FFFFFF;
		border-radius: 12rpx;
	}

	.price-section {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-bottom: 30rpx;
		border-bottom: 1px solid #EEEEEE;
	}

	.price-label {
		font-size: 16px;
		color: #333333;
	}

	.price-value {
		font-size: 24px;
		font-weight: 600;
		color: #FF4D4F;
	}

	.payment-detail {
		margin-top: 30rpx;
	}

	.payment-item {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}

	.payment-label {
		font-size: 14px;
		color: #666666;
	}

	.payment-status {
		font-size: 14px;
		color: #07C160;
	}

	.order-number {
		display: flex;
		align-items: center;
		gap: 10rpx;
	}

	.number-text {
		font-size: 14px;
		color: #333333;
	}

	.payment-method {
		font-size: 14px;
		color: #333333;
	}

	.notice {
		margin: 20rpx;
		padding: 30rpx;
		background-color: #FFFFFF;
		border-radius: 12rpx;
	}

	.notice-title {
		font-size: 16px;
		font-weight: 500;
		color: #333333;
		margin-bottom: 20rpx;
	}

	.notice-content {
		display: flex;
		flex-direction: column;
		gap: 16rpx;
	}

	.notice-item {
		font-size: 14px;
		color: #666666;
		line-height: 1.5;
	}

	.bottom-buttons {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		padding: 20rpx;
		background-color: #FFFFFF;
		box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
		display: flex;
		align-items: center;
		justify-content: space-between;
		z-index: 100;
	}

	.bottom-price {
		display: flex;
		align-items: baseline;
	}

	.price-symbol {
		font-size: 16px;
		color: #FF4D4F;
		margin-right: 4rpx;
	}

	.price-amount {
		font-size: 24px;
		font-weight: 600;
		color: #FF4D4F;
	}

	.book-button {
		background-color: #FF4D4F;
		color: #FFFFFF;
		padding: 20rpx 60rpx;
		border-radius: 40rpx;
		font-size: 16px;
	}
</style>